{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import serial\n",
    "\n",
    "ser=serial.Serial(\"/dev/ttyUSB1\",115200)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "9"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ser.write(b\"#009PCLS!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "b'#009PCLS!#OK!'"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ser.read_all()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "15"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ser.write(b\"#006P1500T0000!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "#006P1700T0000!#006PSPD!#006PSPD=114/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=116/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=119/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=119/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=119/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=119/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=119/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=119/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=120/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=121/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=121/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=121/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=121/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=122/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=124/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n",
      "#006PSPD!#006PSPD=123/100ms!#007PSPD!#007PSPD=0/100ms!#008PSPD!#008PSPD=0/100ms!#009PSPD!#009PSPD=0/100ms!\n"
     ]
    },
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[20], line 6\u001b[0m\n\u001b[1;32m      4\u001b[0m cmd\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m#\u001b[39m\u001b[38;5;132;01m{:03d}\u001b[39;00m\u001b[38;5;124mPSPD!\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mformat(i\u001b[38;5;241m+\u001b[39m\u001b[38;5;241m6\u001b[39m)\n\u001b[1;32m      5\u001b[0m retcode\u001b[38;5;241m=\u001b[39mser\u001b[38;5;241m.\u001b[39mwrite(cmd\u001b[38;5;241m.\u001b[39mencode())\n\u001b[0;32m----> 6\u001b[0m \u001b[43mtime\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msleep\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m0.025\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m      7\u001b[0m ret\u001b[38;5;241m=\u001b[39mser\u001b[38;5;241m.\u001b[39mread_all()\n\u001b[1;32m      8\u001b[0m ret_cmd\u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39mret\u001b[38;5;241m.\u001b[39mdecode()\n",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
     ]
    }
   ],
   "source": [
    "while True:\n",
    "    ret_cmd=\"\"\n",
    "    for i in range(4):\n",
    "        cmd=\"#{:03d}PSPD!\".format(i+6)\n",
    "        retcode=ser.write(cmd.encode())\n",
    "        time.sleep(0.025)\n",
    "        # ret=ser.read_all()\n",
    "        ret=ser.read_until(b'100ms!')\n",
    "        ret_cmd+=ret.decode()\n",
    "    print(ret_cmd)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "429.0"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(33/100)*1300"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
